/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#include "Dialog.h"
#include "../Dialog.h"

namespace liba
{
namespace lib2d
{
namespace gui
{
namespace view
{

Dialog::Dialog( gui::Dialog * obj )
:	Object( obj ),
	obj( obj )
{}

void Dialog::render( hard::Renderer * rend )
{
	view.render( rend, image, obj->get_window_rect().width, obj->get_window_rect().height );
	Object::render( rend );
}

bool Dialog::on_attribute( xml::Provider * prov, const std::string & name, const std::string & value )
{
	if( name == "Image" )
	{
		image = new objects::ImageSimple( value );
		return true;
	}
	return false;
}

bool Dialog::on_node( xml::Provider * prov, const std::string & name )
{
	if( name == "View" )
		return prov->parse_object( &view );
	if( name == "CloseButton" )
		return prov->parse_object( obj->close_button->get_view() );

	return false;
}

} //namespace view
} //namespace gui
} //namespace lib2d
} //namespace liba

